// page/coachs/course/reservation.js
Page({
  data: {
    isHide: false
  },
  onLoad: function (options) {
    console.log(options.timeStr)
    console.log(options.ymd)
    var that = this
    that.request(options.ymd, options.timeStr)
  },

  // 网络请求
  request: function (ymd, timeStr) {
    var that = this
    wx.request({
      url: getApp().globalData.host + "&m=Coach&a=courseInfo", //仅为示例，并非真实的接口地址
      data: {
        "uid": getApp().globalData.uid,
        "ymd": ymd,
        "ymd": timeStr,
      },
      header: {
        'content-type': 'application/json', // 默认值
      },
      method: "POST",
      success: function (res) {
        console.log("res.data")
        console.log(res.data)
        //请求成功
        if (res.data.status == 1) {
          var student = new Object()
          student.avatar = res.data.headimgurl
          student.name = res.data.nickname
          student.sex = res.data.sex
          that.setData({
            isHide: true,
            student:student,
            des:res.data.des
          })
         
        } else {//请求失败
          wx.showToast({
            title: res.data.info,
          })
        }
      },
      fail: function (res) {
        wx.showToast({
          title: "请求失败",
        })
      }
    })
  },


  makePhone: function () {
    wx.makePhoneCall({
      phoneNumber: this.data.course.phone //仅为示例，并非真实的电话号码
    })
  }
})